#!/usr/bin/env python
import sys
def bin(v):
    l = []
    for i in range(8):
        l.append(str(v % 2))
        v = v / 2
    l.reverse()
    return ''.join(l)
class Computer():
    def __init__(self):
        self.mem = []
        self.pc = 0
        self.acc = 0
        self.stop = 0
    def sta(self, address):
        self.mem[address] = bin(self.acc)

    def lda(self, address):
        self.acc = int(self.mem[address], 2) 
    
    def beq(self, value):
        if self.acc == 0:
            self.pc = value
    def nop(self, value):
        pass
    def dec(self, value):
        self.acc -= 1
        if self.acc == -1:
            self.acc = 255
    def inc(self, value):
        self.acc += 1
        if self.acc == 256:
            self.acc = 0
    def jmp(self, value):
        self.pc = value
    def init(self):
        self.__init__()
    def hlt(self, value):
        self.stop = 1 

    def run(self):
        handles = {
            '000':self.sta,
            '001':self.lda,
            '010':self.beq,
            '011':self.nop,
            '100':self.dec,
            '101':self.inc,
            '110':self.jmp,
            '111':self.hlt
        }

        while self.stop != 1:
            ins = self.mem[self.pc]
            cmd = ins[:3]
            data = int(ins[3:], 2)
            self.pc = self.pc + 1
            if self.pc >= 32:
                self.pc = 0
            handles.get(cmd)(data)
        return bin(self.acc)
    def load_mem(self,l):
        self.mem = l[:]     
def main():
    l = []
    com = Computer()
    for line in sys.stdin:
        l.append(line)
        if len(l) == 32:
            com.init()
            com.load_mem(l)
            print com.run()
            l = []

if __name__ == '__main__':
    main()
